#include <iostream>
#include <string>

int main()
{
    std::string s;
    std::cin >> s;
    int start = -1;
    int end = -1;
    int idx = 0;
    int n = s.length();
    int l = -1;
    int r = -1;

    while (idx < n)
    {
        // std::cout << idx << " " << n << std::endl;
        while (idx < n - 1 && (s[idx] != '0' || s[idx + 1] != '1'))
            idx++;

        if (idx == n - 1)
            break;
        start = idx;

        while (idx < n - 1 && (s[idx] != '0' || s[idx + 1] != '0'))
            idx++;
        if (idx == n - 1 && s[idx] != '0')
            break;
        end = idx;

        bool valid = true;
        for (int i = start; i < end; i++)
        {
            if (s[i] == '1' && s[i + 1] == '1')
            {
                valid = false;
                break;
            }
        }

        if (valid && (r - l < end - start))
        {
            l = start;
            r = end;
        }
    }

    if (l == -1)
    {
        std::cout << -1 << std::endl;
    }
    else
    {
        for (int i = l; i <= r; i++)
        {
            std::cout << s[i];
        }
    }

    return 0;
}